*************************************
* Replication of Clippel et al 2014 *
*************************************

set more off

cd "/Users/damienbol/Dropbox/vetoes/Analysis/"

import delimited SL_data.csv, varnames(1) clear

* Calculating variables
***********************

* Pareto dominant options

gen pareto=0
replace pareto=1 if tblnum==1
replace pareto=1 if s2=="a" & tblnum==2
replace pareto=1 if s2=="b" & tblnum==2
replace pareto=1 if s2=="a" & tblnum==3
replace pareto=1 if s2=="b" & tblnum==3
replace pareto=1 if s2=="c" & tblnum==3
replace pareto=1 if s2=="a" & tblnum==4
replace pareto=1 if s2=="c" & tblnum==4

* Consensus options

gen consensus=0
replace consensus=1 if s2=="c" & tblnum==1
replace consensus=1 if s2=="a" & tblnum==2
replace consensus=1 if s2=="b" & tblnum==2
replace consensus=1 if s2=="b" & tblnum==3
replace consensus=1 if s2=="a" & tblnum==4
replace consensus=1 if s2=="c" & tblnum==4

* First-mover advantage

gen pay_firstmover=.
replace pay_firstmover=pay1*20 if whostarts==1
replace pay_firstmover=pay2*20 if whostarts==2

gen pay_secondmover=.
replace pay_secondmover=pay1*20 if whostarts==2
replace pay_secondmover=pay2*20 if whostarts==1

gen firstmover_ad=(pay_firstmover-pay_secondmover)

* Total gain per game (efficiency)

gen total_gain=pay_firstmover+pay_secondmover

* Total absolute difference in payment (inequality)

gen difference_payment=abs(pay_firstmover-pay_secondmover)


* Reordering profile numbers

gen profile=.
replace profile=1 if tblnum==1
replace profile=2 if tblnum==3
replace profile=3 if tblnum==2
replace profile=5 if tblnum==4

* Results
*********

* Effiency and inequality: Pool table

bysort profile: sum total_gain difference_payment

bysort profile: ttest total_gain=1
ttest difference_payment=12 if profile==1
ttest difference_payment=2 if profile==2
ttest difference_payment=4 if profile==3
ttest difference_payment=10 if profile==5

* Consensus, pareto: Pooled table

bysort profile: tab pareto
bysort profile: tab consensus

ttest pareto=1 if tblnum==1
ttest pareto=.4 if tblnum==2
ttest pareto=.6 if tblnum==3
ttest pareto=.4 if tblnum==4

ttest consensus=.2 if tblnum==1
ttest consensus=.4 if tblnum==2
ttest consensus=.2 if tblnum==3
ttest consensus=.4 if tblnum==4

* First-mover advantage: Pooled table

sum firstmover_ad

bysort profile: sum firstmover_ad
bysort profile: ttest pay_firstmover=pay_secondmover

* Effiency and inequality: Separating first and last 20 rounds

bysort profile: sum total_gain difference_payment if roundnum<21
bysort profile: sum total_gain difference_payment if roundnum>20

* First mover advantage: Separating first and last 20 rounds

bysort profile: sum firstmover_ad if roundnum<21
bysort profile: sum firstmover_ad if roundnum>20


*****************
* Personal data *
*****************

import delimited using Personal_data.csv, varnames(1) clear 

* Calculating main variables
*****************************

* Re-ordering profiles

gen profile=1 if preference_profile==1
replace profile=2 if preference_profile==2
replace profile=3 if preference_profile==4
replace profile=4 if preference_profile==3

* Pareto dominant options

drop pareto

gen pareto=0
replace pareto=1 if preference_profile==1
replace pareto=1 if preference_profile==2 & finaloption=="A"
replace pareto=1 if preference_profile==2 & finaloption=="B"
replace pareto=1 if preference_profile==2 & finaloption=="C"
replace pareto=1 if preference_profile==3 & finaloption=="A"
replace pareto=1 if preference_profile==4 & finaloption=="A"
replace pareto=1 if preference_profile==4 & finaloption=="B"

* Consenus options

gen consensus=0
replace consensus=1 if preference_profile==1 & finaloption=="C"
replace consensus=1 if preference_profile==2 & finaloption=="B"
replace consensus=1 if preference_profile==3 & finaloption=="A"
replace consensus=1 if preference_profile==4 & finaloption=="A"
replace consensus=1 if preference_profile==4 & finaloption=="B"

* First-mover advantage

gen pay_firstmover=.
replace pay_firstmover=gain if role==1

gen pay_secondmover=.
replace pay_secondmover=partnersgain if role==1

gen firstmover_ad=(pay_firstmover-pay_secondmover)

* Total gain per game (efficiency)

gen total_gain=gain+partnersgain

* Total absolute difference in payment (inequality)

gen difference_payment=abs(pay_firstmover-pay_secondmover)

* Identifying labs

gen crest=0
replace crest=1 if s<6
replace crest=1 if s>9

* Results sequential mechanism
*******************************

* Inequality and efficiency: Pooled tabled

bysort profile: sum total_gain difference_payment if treatment==1 & role==1

bysort profile: ttest total_gain=20 if treatment==1 & role==1
ttest difference_payment=12 if profile==1
ttest difference_payment=2 if profile==2
ttest difference_payment=4 if profile==3
ttest difference_payment=0 if profile==4

* Inequality and efficiency:  Separating last 20 rounds

bysort profile: sum total_gain difference_payment if treatment==1 & tour<5 & role==1
bysort profile: sum total_gain difference_payment if treatment==1 & tour>4 & role==1

* Consensus and pareto: Pooled table

bysort profile: tab pareto if treatment==1 & role==1
bysort profile: tab consensus if treatment==1 & role==1

ttest pareto=1 if profile==1 & treatment==1 & role==1
ttest pareto=.4 if profile==2 & treatment==1 & role==1
ttest pareto=.6 if profile==3 & treatment==1 & role==1
ttest pareto=.2 if profile==4 & treatment==1 & role==1

ttest consensus=.2 if profile==1 & treatment==1 & role==1
ttest consensus=.4 if profile==2 & treatment==1 & role==1
ttest consensus=.2 if profile==3 & treatment==1 & role==1
ttest consensus=.2 if profile==4 & treatment==1 & role==1

* First mover advantage: Pooled table

bysort profile: sum firstmover_ad if treatment==1 & role==1 // Note the overall mean is 14 and sd is 5
bysort profile: ttest pay_firstmover=pay_secondmover if treatment==1

* First mover advantage: Separating last 20 rounds

bysort profile: sum firstmover_ad if treatment==1 & tour<5 & role==1
bysort profile: sum firstmover_ad if treatment==1 & tour>4 & role==1

* Results all mechanisms (efficiency and inequality)
****************************************************

* Resuts: Pooled table

sum total_gain if treatment!=2 & role==1
sum difference_payment if treatment!=2 & role==1

bysort profile: sum total_gain if treatment==0 & role==1 // Simultaneous
bysort profile: sum difference_payment if treatment==0 & role==1

bysort profile: sum total_gain if treatment==3 & role==1 // Gradual
bysort profile: sum difference_payment if treatment==3  & role==1

bysort profile: ttest total_gain if (treatment==0 | treatment==1) & role==1, by(treatment)  // Simultaneous vs Sequential
bysort profile: ttest difference_payment if (treatment==0 | treatment==1)  & role==1, by(treatment)

bysort profile: ttest total_gain if (treatment==3 | treatment==1) & role==1, by(treatment)  // Gradual vetoes vs Sequential
bysort profile: ttest difference_payment if (treatment==3 | treatment==1)  & role==1, by(treatment)

bysort profile: ttest total_gain if (treatment==3 | treatment==0) & role==1, by(treatment)  // Simultaneous vs Gradual Vetoes
bysort profile: ttest difference_payment if (treatment==3 | treatment==0)  & role==1, by(treatment)


* Results: Separating last 20 rounds

bysort profile: sum total_gain difference_payment if treatment==0 & tour<5 & role==1 // Simultaneous
bysort profile: sum total_gain difference_payment if treatment==0 & tour>4 & role==1

bysort profile: sum total_gain difference_payment if treatment==3 & tour<5 & role==1 // Gradual
bysort profile: sum total_gain difference_payment if treatment==3 & tour>4 & role==1

* Results: regression

reg total_gain ib(1).treatment if treatment!=2 & profile==1 & role==1, vce(cluster session)
reg total_gain ib(0).treatment if treatment!=2 & profile==1 & role==1, vce(cluster session)

reg total_gain ib(1).treatment if treatment!=2 & profile==2 & role==1, vce(cluster session)
reg total_gain ib(0).treatment if treatment!=2 & profile==2 & role==1, vce(cluster session)

reg total_gain ib(1).treatment if treatment!=2 & profile==3 & role==1, vce(cluster session)
reg total_gain ib(0).treatment if treatment!=2 & profile==3 & role==1, vce(cluster session)

reg total_gain ib(1).treatment if treatment!=2 & profile==4 & role==1, vce(cluster session)
reg total_gain ib(0).treatment if treatment!=2 & profile==4 & role==1, vce(cluster session)

reg difference_payment ib(1).treatment if treatment!=2 & profile==1 & role==1, vce(cluster session)
reg difference_payment ib(0).treatment if treatment!=2 & profile==1 & role==1, vce(cluster session)

reg difference_payment ib(1).treatment if treatment!=2 & profile==2 & role==1, vce(cluster session)
reg difference_payment ib(0).treatment if treatment!=2 & profile==2 & role==1, vce(cluster session)

reg difference_payment ib(1).treatment if treatment!=2 & profile==3 & role==1, vce(cluster session)
reg difference_payment ib(0).treatment if treatment!=2 & profile==3 & role==1, vce(cluster session)

reg difference_payment ib(1).treatment if treatment!=2 & profile==4 & role==1, vce(cluster session)
reg difference_payment ib(0).treatment if treatment!=2 & profile==4 & role==1, vce(cluster session)



* Results all mechanisms (pareto and consensus)
*************************************************

* Consensus and pareto: Pooled table

bysort profile: tab pareto if treatment==0 & role==1 // Simultaneous
bysort profile: tab consensus if treatment==0 & role==1

bysort profile: tab pareto if treatment==3 & role==1 // Gradual
bysort profile: tab consensus if treatment==3 & role==1

bysort profile: ttest pareto if (treatment==0 | treatment==1) & role==1, by(treatment)  // Simultaneous vs Sequential
bysort profile: ttest consensus if (treatment==0 | treatment==1) & role==1, by(treatment)

bysort profile: ttest pareto if (treatment==3 | treatment==1) & role==1, by(treatment)  // Gradual vetoes vs Sequential
bysort profile: ttest consensus if (treatment==3 | treatment==1) & role==1, by(treatment)

bysort profile: ttest pareto if (treatment==3 | treatment==0) & role==1, by(treatment)  // Gradual vetoes vs Simultaneous
bysort profile: ttest consensus if (treatment==3 | treatment==0) & role==1, by(treatment)

* First mover advantage

bysort profile: sum firstmover_ad if role==1 & treatment==0 // Simultaneous
bysort profile: sum firstmover_ad if role==1 & treatment==3 // Gradual

* Consensus and pareto: Separating last 20 rounds

bysort profile: tab pareto if treatment==0 & tour<5 & role==1 // Simultaneous
bysort profile: tab pareto if treatment==0 & tour>4 & role==1

bysort profile: tab pareto if treatment==3 & tour<5 & role==1  // Gradual
bysort profile: tab pareto if treatment==3 & tour>4 & role==1

bysort profile: tab consensus if treatment==0 & tour<5 & role==1  // Simultaneous
bysort profile: tab consensus if treatment==0 & tour>4 & role==1

bysort profile: tab consensus if treatment==3 & tour<5 & role==1 // Gradual
bysort profile: tab consensus if treatment==3 & tour>4 & role==1

* Results all mechanisms (lottery)
**********************************

* Splitting variable common options

split commonoptions, parse(,) generate(common)

* Number of lotteries

drop lottery
gen lottery=0
replace lottery=1 if common2!=""

* Generate pareto-only and consensus-only variables

gen pareto_only=0
replace pareto_only=1 if preference_profile==1
replace pareto_only=1 if preference_profile==2 & finaloption=="A"
replace pareto_only=1 if preference_profile==2 & finaloption=="B"
replace pareto_only=1 if preference_profile==2 & finaloption=="C"
replace pareto_only=1 if preference_profile==3 & finaloption=="A"
replace pareto_only=1 if preference_profile==4 & finaloption=="A"
replace pareto_only=1 if preference_profile==4 & finaloption=="B"

replace pareto_only=0 if preference_profile==2 & (common1=="D"| common2=="D" | common3=="D")
replace pareto_only=0 if preference_profile==2 & (common1=="E" | common2=="E" | common3=="E")
replace pareto_only=0 if preference_profile==3 & lottery==1
replace pareto_only=0 if preference_profile==4 & (common1=="C" | common2=="C" | common3=="C")
replace pareto_only=0 if preference_profile==4 & (common1=="D" | common2=="D" | common3=="D")
replace pareto_only=0 if preference_profile==4 & (common1=="E" | common2=="E" | common3=="E")

gen consensus_only=0
replace consensus_only=1 if preference_profile==1 & finaloption=="C"
replace consensus_only=1 if preference_profile==2 & finaloption=="B"
replace consensus_only=1 if preference_profile==3 & finaloption=="A"
replace consensus_only=1 if preference_profile==4 & finaloption=="A"
replace consensus_only=1 if preference_profile==4 & finaloption=="B"

replace consensus_only=0 if preference_profile==1 & lottery==1
replace consensus_only=0 if preference_profile==2 & lottery==1
replace consensus_only=0 if preference_profile==3 & lottery==1
replace consensus_only=0 if preference_profile==4 & (common1=="C" | common2=="C" | common3=="C")
replace consensus_only=0 if preference_profile==4 & (common1=="D" | common2=="D" | common3=="D")
replace consensus_only=0 if preference_profile==4 & (common1=="E" | common2=="E" | common3=="E")

* Resuts: Pooled table

tab lottery if role==1 & treatment!=1 & treatment!=2
bysort treatment: tab lottery if role==1 & treatment!=1 & treatment!=2

bysort treatment profile: tab lottery if role==1 & treatment!=1 & treatment!=2

bysort profile: tab pareto_only if treatment==0 & role==1 // Simultaneous
bysort profile: tab consensus_only if treatment==0 & role==1

bysort profile: tab pareto_only if treatment==3 & role==1 // Gradual
bysort profile: tab consensus_only if treatment==3 & role==1

bysort profile: ttest pareto_only if (treatment==0 | treatment==1) & role==1, by(treatment)  // Simultaneous vs Sequential
bysort profile: ttest consensus_only if (treatment==0 | treatment==1) & role==1, by(treatment)

bysort profile: ttest pareto_only if (treatment==3 | treatment==1) & role==1, by(treatment)  // Gradual vetoes vs Sequential
bysort profile: ttest consensus_only if (treatment==3 | treatment==1) & role==1, by(treatment)

bysort profile: ttest pareto_only if (treatment==3 | treatment==0) & role==1, by(treatment)  // Gradual vetoes vs Simultaneous
bysort profile: ttest consensus_only if (treatment==3 | treatment==0) & role==1, by(treatment)


* Full results
**************

* Final option by preference profile

tab finaloption treatment if profile==1 & role==1, col
tab finaloption treatment if profile==2 & role==1, col
tab finaloption treatment if profile==3 & role==1, col
tab finaloption treatment if profile==4 & role==1, col

* Results focusing on CREST lab
*******************************

* Efficiency and inequality

bysort profile: sum total_gain if treatment==1 & role==1 & crest==1 // Sequential
bysort profile: sum difference_payment if treatment==1 & role==1 & crest==1

bysort profile: sum total_gain if treatment==0 & role==1 & crest==1 // Simultaneous
bysort profile: sum difference_payment if treatment==0 & role==1 & crest==1

bysort profile: sum total_gain if treatment==3 & role==1 & crest==1 // Gradual
bysort profile: sum difference_payment if treatment==3  & role==1 & crest==1

bysort profile: ttest total_gain if (treatment==0 | treatment==1) & role==1 & crest==1, by(treatment)  // Simultaneous vs Sequential
bysort profile: ttest difference_payment if (treatment==0 | treatment==1) & role==1 & crest==1, by(treatment)

bysort profile: ttest total_gain if (treatment==3 | treatment==1) & role==1 & crest==1, by(treatment)  // Gradual vetoes vs Sequential
bysort profile: ttest difference_payment if (treatment==3 | treatment==1) & role==1 & crest==1, by(treatment)

bysort profile: ttest total_gain if (treatment==3 | treatment==0) & role==1 & crest==1, by(treatment)  // Simultaneous vs Gradual Vetoes
bysort profile: ttest difference_payment if (treatment==3 | treatment==0) & role==1 & crest==1, by(treatment)


* Pareto and consensus 

bysort profile: tab pareto if treatment==1 & role==1 & crest==1 // Sequential 
bysort profile: tab consensus if treatment==1 & role==1 & crest==1 

bysort profile: tab pareto if treatment==0 & role==1 & crest==1 // Simultaneous
bysort profile: tab consensus if treatment==0 & role==1 & crest==1 

bysort profile: tab pareto if treatment==3 & role==1 & crest==1 // Gradual
bysort profile: tab consensus if treatment==3 & role==1 & crest==1

bysort profile: ttest pareto if (treatment==0 | treatment==1) & role==1 & crest==1, by(treatment)  // Simultaneous vs Sequential
bysort profile: ttest consensus if (treatment==0 | treatment==1) & role==1 & crest==1, by(treatment)

bysort profile: ttest pareto if (treatment==3 | treatment==1) & role==1 & crest==1, by(treatment)  // Gradual vetoes vs Sequential
bysort profile: ttest consensus if (treatment==3 | treatment==1) & role==1 & crest==1, by(treatment)

bysort profile: ttest pareto if (treatment==3 | treatment==0) & role==1 & crest==1, by(treatment)  // Gradual vetoes vs Simultaneous
bysort profile: ttest consensus if (treatment==3 | treatment==0) & role==1 & crest==1, by(treatment)


* Lotteries

bysort profile: tab pareto_only if treatment==0 & role==1 & crest==1 // Simultaneous
bysort profile: tab consensus_only if treatment==0 & role==1 & crest==1
bysort profile: tab lottery if role==1 & treatment==0 & crest==1

bysort profile: tab pareto_only if treatment==3 & role==1 & crest==1 // Gradual
bysort profile: tab consensus_only if treatment==3 & role==1  & crest==1
bysort profile: tab lottery if role==1 & treatment==3 & crest==1


bysort profile: ttest pareto_only if (treatment==0 | treatment==1) & role==1 & crest==1, by(treatment)  // Simultaneous vs Sequential
bysort profile: ttest consensus_only if (treatment==0 | treatment==1) & role==1 & crest==1, by(treatment)

bysort profile: ttest pareto_only if (treatment==3 | treatment==1) & role==1  & crest==1, by(treatment)  // Gradual vetoes vs Sequential
bysort profile: ttest consensus_only if (treatment==3 | treatment==1) & role==1 & crest==1, by(treatment)

bysort profile: ttest pareto_only if (treatment==3 | treatment==0) & role==1  & crest==1, by(treatment)  // Gradual vetoes vs Simultaneous
bysort profile: ttest consensus_only if (treatment==3 | treatment==0) & role==1  & crest==1, by(treatment)

* Results (individual stragtegies)
**********************************

* Splitting "options" variable

split options, parse(,) generate(option_chosen)

* Identifying the options vetoed in the first round

gen veto_a=0
gen veto_b=0
gen veto_c=0
gen veto_d=0
gen veto_e=0

replace veto_a=1 if option_chosen1!="A" & option_chosen2!="A" & option_chosen3!="A" & option_chosen4!="A" & option_chosen5!="A" & treatment==0 // Simultaneous
replace veto_b=1 if option_chosen1!="B" & option_chosen2!="B" & option_chosen3!="B" & option_chosen4!="B" & option_chosen5!="B" & treatment==0
replace veto_c=1 if option_chosen1!="C" & option_chosen2!="C" & option_chosen3!="C" & option_chosen4!="C" & option_chosen5!="C" & treatment==0
replace veto_d=1 if option_chosen1!="D" & option_chosen2!="D" & option_chosen3!="D" & option_chosen4!="D" & option_chosen5!="D" & treatment==0
replace veto_e=1 if option_chosen1!="E" & option_chosen2!="E" & option_chosen3!="E" & option_chosen4!="E" & option_chosen5!="E" & treatment==0

replace veto_a=1 if option_chosen1!="A" & option_chosen2!="A" & option_chosen3!="A" & option_chosen4!="A" & option_chosen5!="A" & treatment==1 & role==1 // Sequental
replace veto_b=1 if option_chosen1!="B" & option_chosen2!="B" & option_chosen3!="B" & option_chosen4!="B" & option_chosen5!="B" & treatment==1 & role==1
replace veto_c=1 if option_chosen1!="C" & option_chosen2!="C" & option_chosen3!="C" & option_chosen4!="C" & option_chosen5!="C" & treatment==1 & role==1
replace veto_d=1 if option_chosen1!="D" & option_chosen2!="D" & option_chosen3!="D" & option_chosen4!="D" & option_chosen5!="D" & treatment==1 & role==1
replace veto_e=1 if option_chosen1!="E" & option_chosen2!="E" & option_chosen3!="E" & option_chosen4!="E" & option_chosen5!="E" & treatment==1 & role==1

replace veto_a=1 if elim1=="A" & treatment==3 // Gradual
replace veto_b=1 if elim1=="B" & treatment==3
replace veto_c=1 if elim1=="C" & treatment==3
replace veto_d=1 if elim1=="D" & treatment==3
replace veto_e=1 if elim1=="E" & treatment==3

gen veto_aR2=0
gen veto_bR2=0
gen veto_cR2=0
gen veto_dR2=0
gen veto_eR2=0

replace veto_aR2=1 if elim2=="A" & treatment==3 // Gradual round 2
replace veto_bR2=1 if elim2=="B" & treatment==3
replace veto_cR2=1 if elim2=="C" & treatment==3
replace veto_dR2=1 if elim2=="D" & treatment==3
replace veto_eR2=1 if elim2=="E" & treatment==3

* Splitting "partneroptions" variable

split partneroptions, parse(,) generate(opp_option_chosen)

* Identifying the options vetoed in the first round by opponent

gen opp_veto_a=0
gen opp_veto_b=0
gen opp_veto_c=0
gen opp_veto_d=0
gen opp_veto_e=0

replace opp_veto_a=1 if opp_option_chosen1!="A" & opp_option_chosen2!="A" & opp_option_chosen3!="A" & opp_option_chosen4!="A" & opp_option_chosen5!="A" & treatment==0 // Simultaneous
replace opp_veto_b=1 if opp_option_chosen1!="B" & opp_option_chosen2!="B" & opp_option_chosen3!="B" & opp_option_chosen4!="B" & opp_option_chosen5!="B" & treatment==0
replace opp_veto_c=1 if opp_option_chosen1!="C" & opp_option_chosen2!="C" & opp_option_chosen3!="C" & opp_option_chosen4!="C" & opp_option_chosen5!="C" & treatment==0
replace opp_veto_d=1 if opp_option_chosen1!="D" & opp_option_chosen2!="D" & opp_option_chosen3!="D" & opp_option_chosen4!="D" & opp_option_chosen5!="D" & treatment==0
replace opp_veto_e=1 if opp_option_chosen1!="E" & opp_option_chosen2!="E" & opp_option_chosen3!="E" & opp_option_chosen4!="E" & opp_option_chosen5!="E" & treatment==0

replace opp_veto_a=1 if partnerelim1=="A" & treatment==3 // Gradual
replace opp_veto_b=1 if partnerelim1=="B" & treatment==3
replace opp_veto_c=1 if partnerelim1=="C" & treatment==3
replace opp_veto_d=1 if partnerelim1=="D" & treatment==3
replace opp_veto_e=1 if partnerelim1=="E" & treatment==3

gen opp_veto_aR2=0 // Gradual round 2
gen opp_veto_bR2=0
gen opp_veto_cR2=0
gen opp_veto_dR2=0
gen opp_veto_eR2=0

replace opp_veto_aR2=1 if partnerelim2=="A" & treatment==3
replace opp_veto_bR2=1 if partnerelim2=="B" & treatment==3
replace opp_veto_cR2=1 if partnerelim2=="C" & treatment==3
replace opp_veto_dR2=1 if partnerelim2=="D" & treatment==3
replace opp_veto_eR2=1 if partnerelim2=="E" & treatment==3

* Identifying options vetoed in rounds 3 and 4 (gradual)

gen veto_aR3=0
gen veto_bR3=0
gen veto_cR3=0
gen veto_dR3=0
gen veto_eR3=0

replace veto_aR3=1 if elim3=="A" & treatment==3
replace veto_bR3=1 if elim3=="B" & treatment==3
replace veto_cR3=1 if elim3=="C" & treatment==3
replace veto_dR3=1 if elim3=="D" & treatment==3
replace veto_eR3=1 if elim3=="E" & treatment==3

gen veto_aR4=0
gen veto_bR4=0
gen veto_cR4=0
gen veto_dR4=0
gen veto_eR4=0

replace veto_aR4=1 if elim4=="A" & treatment==3
replace veto_bR4=1 if elim4=="B" & treatment==3
replace veto_cR4=1 if elim4=="C" & treatment==3
replace veto_dR4=1 if elim4=="D" & treatment==3
replace veto_eR4=1 if elim4=="E" & treatment==3

* Identifying same veto strategy

gen same_a=0
gen same_b=0
gen same_c=0
gen same_d=0
gen same_e=0

gen same_aR2=0
gen same_bR2=0
gen same_cR2=0
gen same_dR2=0
gen same_eR2=0

replace same_a=1 if veto_a==1 & opp_veto_a==1
replace same_b=1 if veto_b==1 & opp_veto_b==1
replace same_c=1 if veto_c==1 & opp_veto_c==1
replace same_d=1 if veto_d==1 & opp_veto_d==1
replace same_e=1 if veto_e==1 & opp_veto_e==1

replace same_aR2=1 if veto_aR2==1 & opp_veto_aR2==1
replace same_bR2=1 if veto_bR2==1 & opp_veto_bR2==1
replace same_cR2=1 if veto_cR2==1 & opp_veto_cR2==1
replace same_dR2=1 if veto_dR2==1 & opp_veto_dR2==1
replace same_eR2=1 if veto_eR2==1 & opp_veto_eR2==1

gen same_sum=same_a+same_b+same_c+same_d+same_e+same_aR2+same_bR2+same_cR2+same_dR2+same_eR2

gen same1=0
replace same1=1 if same_sum==1 | same_sum==2

gen same2=0
replace same2=1 if same_sum==2

* Filling up "matrixform" variable

replace matrixform="20,0;15,5;10,10;5,15;0,20" if profile==1
replace matrixform="20,10;15,15;10,20;5,5;0,0" if profile==2
replace matrixform="20,15;15,20;10,10;5,5;0,0" if profile==3
replace matrixform="20,20;15,15;10,10;5,5;0,0" if profile==4

* Splitting "payoff matrix" variable

split matrixform, parse(;) generate(temp)
split temp1, parse(,) generate(payoff1)
split temp2, parse(,) generate(payoff2)
split temp3, parse(,) generate(payoff3)
split temp4, parse(,) generate(payoff4)
split temp5, parse(,) generate(payoff5)

destring payoff11, gen(n_payoff11)
destring payoff12, gen(n_payoff12)
destring payoff21, gen(n_payoff21)
destring payoff22, gen(n_payoff22)
destring payoff31, gen(n_payoff31)
destring payoff32, gen(n_payoff32)
destring payoff41, gen(n_payoff41)
destring payoff42, gen(n_payoff42)
destring payoff51, gen(n_payoff51)
destring payoff52, gen(n_payoff52)

* Assigning each payoff to each option

gen payoff_a=n_payoff11 if role==1
gen payoff_b=n_payoff21 if role==1
gen payoff_c=n_payoff31 if role==1
gen payoff_d=n_payoff41 if role==1
gen payoff_e=n_payoff51 if role==1

replace payoff_a=n_payoff12 if role==2
replace payoff_b=n_payoff22 if role==2
replace payoff_c=n_payoff32 if role==2
replace payoff_d=n_payoff42 if role==2
replace payoff_e=n_payoff52 if role==2

* Assigning payoff of opponent to each option

gen opp_payoff_a=n_payoff12 if role==1
gen opp_payoff_b=n_payoff22 if role==1
gen opp_payoff_c=n_payoff32 if role==1
gen opp_payoff_d=n_payoff42 if role==1
gen opp_payoff_e=n_payoff52 if role==1

replace opp_payoff_a=n_payoff11 if role==2
replace opp_payoff_b=n_payoff21 if role==2
replace opp_payoff_c=n_payoff31 if role==2
replace opp_payoff_d=n_payoff41 if role==2
replace opp_payoff_e=n_payoff51 if role==2

* Identifying remaining options in round 2 sequential

gen remaining_aR2=1 if (option_chosen1=="A" & treatment==1 & role==1)
replace remaining_aR2=1 if (option_chosen2=="A" & treatment==1 & role==1)
replace remaining_aR2=1 if (option_chosen3=="A" & treatment==1 & role==1)
replace remaining_aR2=1 if (option_chosen4=="A" & treatment==1 & role==1)
replace remaining_aR2=1 if (option_chosen5=="A" & treatment==1 & role==1)

gen remaining_bR2=1 if (option_chosen1=="B" & treatment==1 & role==1)
replace remaining_bR2=1 if (option_chosen2=="B" & treatment==1 & role==1)
replace remaining_bR2=1 if (option_chosen3=="B" & treatment==1 & role==1)
replace remaining_bR2=1 if (option_chosen4=="B" & treatment==1 & role==1)
replace remaining_bR2=1 if (option_chosen5=="B" & treatment==1 & role==1)

gen remaining_cR2=1 if (option_chosen1=="C" & treatment==1 & role==1)
replace remaining_cR2=1 if (option_chosen2=="C" & treatment==1 & role==1)
replace remaining_cR2=1 if (option_chosen3=="C" & treatment==1 & role==1)
replace remaining_cR2=1 if (option_chosen4=="C" & treatment==1 & role==1)
replace remaining_cR2=1 if (option_chosen5=="C" & treatment==1 & role==1)

gen remaining_dR2=1 if (option_chosen1=="D" & treatment==1 & role==1)
replace remaining_dR2=1 if (option_chosen2=="D" & treatment==1 & role==1)
replace remaining_dR2=1 if (option_chosen3=="D" & treatment==1 & role==1)
replace remaining_dR2=1 if (option_chosen4=="D" & treatment==1 & role==1)
replace remaining_dR2=1 if (option_chosen5=="D" & treatment==1 & role==1)

gen remaining_eR2=1 if (option_chosen1=="E" & treatment==1 & role==1)
replace remaining_eR2=1 if (option_chosen2=="E" & treatment==1 & role==1)
replace remaining_eR2=1 if (option_chosen3=="E" & treatment==1 & role==1)
replace remaining_eR2=1 if (option_chosen4=="E" & treatment==1 & role==1)
replace remaining_eR2=1 if (option_chosen5=="E" & treatment==1 & role==1)

* Identifying remaining options in round 2, 3, and 4 gradual

replace remaining_aR2=1 if (elim1!="A" & partnerelim1!="A" & treatment==3)
replace remaining_bR2=1 if (elim1!="B" & partnerelim1!="B" & treatment==3)
replace remaining_cR2=1 if (elim1!="C" & partnerelim1!="C" & treatment==3)
replace remaining_dR2=1 if (elim1!="D" & partnerelim1!="D" & treatment==3)
replace remaining_eR2=1 if (elim1!="E" & partnerelim1!="E" & treatment==3)

gen remaining_aR3=1 if (elim1!="A" & partnerelim1!="A" & elim2!="A" & partnerelim2!="A" & treatment==3)
gen remaining_bR3=1 if (elim1!="B" & partnerelim1!="B" & elim2!="B" & partnerelim2!="B" & treatment==3)
gen remaining_cR3=1 if (elim1!="C" & partnerelim1!="C" & elim2!="C" & partnerelim2!="C" & treatment==3)
gen remaining_dR3=1 if (elim1!="D" & partnerelim1!="D" & elim2!="D" & partnerelim2!="D" & treatment==3)
gen remaining_eR3=1 if (elim1!="E" & partnerelim1!="E" & elim2!="E" & partnerelim2!="E" & treatment==3)

gen remaining_aR4=1 if (elim1!="A" & partnerelim1!="A" & elim2!="A" & partnerelim2!="A" & elim3!="A" & partnerelim3!="A" & treatment==3)
gen remaining_bR4=1 if (elim1!="B" & partnerelim1!="B" & elim2!="B" & partnerelim2!="B" & elim3!="B" & partnerelim3!="B" & treatment==3)
gen remaining_cR4=1 if (elim1!="C" & partnerelim1!="C" & elim2!="C" & partnerelim2!="C" & elim3!="C" & partnerelim3!="C" & treatment==3)
gen remaining_dR4=1 if (elim1!="D" & partnerelim1!="D" & elim2!="D" & partnerelim2!="D" & elim3!="D" & partnerelim3!="D" & treatment==3)
gen remaining_eR4=1 if (elim1!="E" & partnerelim1!="E" & elim2!="E" & partnerelim2!="E" & elim3!="E" & partnerelim3!="E" & treatment==3)

* Identifying cautious strategy

gen cautious_a=0
gen cautious_b=0
gen cautious_c=0
gen cautious_d=0
gen cautious_e=0

replace cautious_a=1 if payoff_a==0 & veto_a==1
replace cautious_b=1 if payoff_b==0 & veto_b==1
replace cautious_c=1 if payoff_c==0 & veto_c==1
replace cautious_d=1 if payoff_d==0 & veto_d==1
replace cautious_e=1 if payoff_e==0 & veto_e==1

gen cautious_sum=cautious_a+cautious_b+cautious_c+cautious_d+cautious_e

replace cautious_a=1 if payoff_a==5 & veto_a==1 & cautious_sum==1 & treatment!=3
replace cautious_b=1 if payoff_b==5 & veto_b==1 & cautious_sum==1 & treatment!=3
replace cautious_c=1 if payoff_c==5 & veto_c==1 & cautious_sum==1 & treatment!=3
replace cautious_d=1 if payoff_d==5 & veto_d==1 & cautious_sum==1 & treatment!=3
replace cautious_e=1 if payoff_e==5 & veto_e==1 & cautious_sum==1 & treatment!=3

gen payoff_aR2=.  // Calculating remaining payoffs in round 2 gradual
gen payoff_bR2=.
gen payoff_cR2=.
gen payoff_dR2=.
gen payoff_eR2=.

replace payoff_aR2=payoff_a if remaining_aR2==1 & treatment==3
replace payoff_bR2=payoff_b if remaining_bR2==1 & treatment==3
replace payoff_cR2=payoff_c if remaining_cR2==1 & treatment==3
replace payoff_dR2=payoff_d if remaining_dR2==1 & treatment==3
replace payoff_eR2=payoff_e if remaining_eR2==1 & treatment==3

gen min_payoffR2=min(payoff_aR2, payoff_bR2, payoff_cR2, payoff_dR2, payoff_eR2)

gen cautious_aR2=0
gen cautious_bR2=0
gen cautious_cR2=0
gen cautious_dR2=0
gen cautious_eR2=0

replace cautious_aR2=1 if payoff_a==min_payoffR2 & veto_aR2==1 & treatment==3
replace cautious_bR2=1 if payoff_b==min_payoffR2 & veto_bR2==1 & treatment==3
replace cautious_cR2=1 if payoff_c==min_payoffR2 & veto_cR2==1 & treatment==3
replace cautious_dR2=1 if payoff_d==min_payoffR2 & veto_dR2==1 & treatment==3
replace cautious_eR2=1 if payoff_e==min_payoffR2 & veto_eR2==1 & treatment==3

replace cautious_sum=cautious_a+cautious_b+cautious_c+cautious_d+cautious_e+cautious_aR2+cautious_bR2+cautious_cR2+cautious_dR2+cautious_eR2

gen cautious1=0
replace cautious1=1 if cautious_sum==1 | cautious_sum==2

gen cautious2=0
replace cautious2=1 if cautious_sum==2

* Identifying focal payoff of your opponent, i.e. opponent's payoff at your highest payoff

gen focal=opp_payoff_a if payoff_a==20
replace focal=opp_payoff_b if payoff_b==20
replace focal=opp_payoff_c if payoff_c==20
replace focal=opp_payoff_d if payoff_d==20
replace focal=opp_payoff_e if payoff_e==20

gen max_payoffR2=max(payoff_aR2, payoff_bR2, payoff_cR2, payoff_dR2, payoff_eR2) // Calculating focal point for round 2 gradual

gen focal2=opp_payoff_a if payoff_a==max_payoffR2 & treatment==3 
replace focal2=opp_payoff_b if payoff_b==max_payoffR2 & treatment==3
replace focal2=opp_payoff_c if payoff_c==max_payoffR2 & treatment==3
replace focal2=opp_payoff_d if payoff_d==max_payoffR2 & treatment==3
replace focal2=opp_payoff_e if payoff_e==max_payoffR2 & treatment==3

* Identifying options that have higher payoffs for your opponent than focal payoff

gen a_better=0
gen b_better=0
gen c_better=0
gen d_better=0
gen e_better=0

replace a_better=1 if opp_payoff_a>focal
replace b_better=1 if opp_payoff_b>focal
replace c_better=1 if opp_payoff_c>focal
replace d_better=1 if opp_payoff_d>focal
replace e_better=1 if opp_payoff_e>focal

gen a_betterR2=0
gen b_betterR2=0
gen c_betterR2=0
gen d_betterR2=0
gen e_betterR2=0

replace a_betterR2=1 if opp_payoff_a>focal2 & treatment==3
replace b_betterR2=1 if opp_payoff_b>focal2 & treatment==3
replace c_betterR2=1 if opp_payoff_c>focal2 & treatment==3
replace d_betterR2=1 if opp_payoff_d>focal2 & treatment==3
replace e_betterR2=1 if opp_payoff_e>focal2 & treatment==3

* Identifying aggresive strategy

gen aggressive_a=0
gen aggressive_b=0
gen aggressive_c=0
gen aggressive_d=0
gen aggressive_e=0

replace aggressive_a=1 if a_better==1 & veto_a==1
replace aggressive_b=1 if b_better==1 & veto_b==1
replace aggressive_c=1 if c_better==1 & veto_c==1
replace aggressive_d=1 if d_better==1 & veto_d==1
replace aggressive_e=1 if e_better==1 & veto_e==1

gen aggressive_aR2=0
gen aggressive_bR2=0
gen aggressive_cR2=0
gen aggressive_dR2=0
gen aggressive_eR2=0

replace aggressive_aR2=1 if a_betterR2==1 & veto_aR2==1 & treatment==3
replace aggressive_bR2=1 if b_betterR2==1 & veto_bR2==1 & treatment==3
replace aggressive_cR2=1 if c_betterR2==1 & veto_cR2==1 & treatment==3
replace aggressive_dR2=1 if d_betterR2==1 & veto_dR2==1 & treatment==3
replace aggressive_eR2=1 if e_betterR2==1 & veto_eR2==1 & treatment==3

gen aggressive_sum=aggressive_a+aggressive_b+aggressive_c+aggressive_d+aggressive_e+aggressive_aR2+aggressive_bR2+aggressive_cR2+aggressive_dR2+aggressive_eR2

gen aggressive1=0
replace aggressive1=1 if aggressive_sum==1 | aggressive_sum==2

gen aggressive2=0
replace aggressive2=1 if aggressive_sum==2

* Expanding dataset

expand 2, gen(id)

gen same_final=same1 if id==0
replace same_final=same2 if id==1

gen cautious_final=cautious1 if id==0
replace cautious_final=cautious2 if id==1

gen aggressive_final=aggressive1 if id==0
replace aggressive_final=aggressive2 if id==1

* Results same vetoes: pooled table

bysort profile: ttest same_final if treatment==0  | treatment==3, by(treatment)

bysort profile: tab same_final if treatment==0
bysort profile: tab same_final if treatment==3


* Results cautious vetoes: pooled table

bysort profile: ttest cautious_final if treatment==0  | treatment==3, by(treatment)
bysort profile: ttest cautious_final if treatment==0  | treatment==1, by(treatment)
bysort profile: ttest cautious_final if treatment==1  | treatment==3, by(treatment)

bysort profile: tab cautious_final if treatment==1
bysort profile: tab cautious_final if treatment==0
bysort profile: tab cautious_final if treatment==3

* Results aggressive vetoes: pooled table

bysort profile: ttest aggressive_final if treatment==0  | treatment==3, by(treatment)
bysort profile: ttest aggressive_final if treatment==0  | treatment==1, by(treatment)
bysort profile: ttest aggressive_final if treatment==1  | treatment==3, by(treatment)

bysort profile: tab aggressive_final if treatment==1
bysort profile: tab aggressive_final if treatment==0
bysort profile: tab aggressive_final if treatment==3


* Result for further rounds (sequential and gradual)
****************************************************

drop if id==1

* Identifying best payoff among remaining options in round 2 sequential

gen opp_payoff_aR2=opp_payoff_a if remaining_aR2==1 & treatment==1 & role==1
gen opp_payoff_bR2=opp_payoff_b if remaining_bR2==1 & treatment==1 & role==1
gen opp_payoff_cR2=opp_payoff_c if remaining_cR2==1 & treatment==1 & role==1
gen opp_payoff_dR2=opp_payoff_d if remaining_dR2==1 & treatment==1 & role==1
gen opp_payoff_eR2=opp_payoff_e if remaining_eR2==1 & treatment==1 & role==1

gen max_payoffR2_bis=max(opp_payoff_aR2, opp_payoff_bR2, opp_payoff_cR2, opp_payoff_dR2, opp_payoff_eR2) if treatment==1 & role==1

* Identifying whether respondent chose best payoff in round 2 sequential

gen optimal=0
replace optimal=1 if partnerschoice=="A" & max_payoffR2_bis==opp_payoff_aR2 & role==1 & treatment==1
replace optimal=1 if partnerschoice=="B" & max_payoffR2_bis==opp_payoff_bR2 & role==1 & treatment==1
replace optimal=1 if partnerschoice=="C" & max_payoffR2_bis==opp_payoff_cR2 & role==1 & treatment==1
replace optimal=1 if partnerschoice=="D" & max_payoffR2_bis==opp_payoff_dR2 & role==1 & treatment==1
replace optimal=1 if partnerschoice=="E" & max_payoffR2_bis==opp_payoff_eR2 & role==1 & treatment==1

* Results for Round 2 Sequential

tab optimal if treatment==1 & role==1

* Identifying same vetoes

gen same_aR3=0
gen same_bR3=0
gen same_cR3=0
gen same_dR3=0
gen same_eR3=0

replace same_aR3=1 if veto_aR3==1 & partnerelim3=="A"
replace same_bR3=1 if veto_bR3==1 & partnerelim3=="B"
replace same_cR3=1 if veto_cR3==1 & partnerelim3=="C"
replace same_dR3=1 if veto_dR3==1 & partnerelim3=="D"
replace same_eR3=1 if veto_eR3==1 & partnerelim3=="E"

gen same_aR4=0
gen same_bR4=0
gen same_cR4=0
gen same_dR4=0
gen same_eR4=0

replace same_aR4=1 if veto_aR4==1 & partnerelim4=="A"
replace same_bR4=1 if veto_bR4==1 & partnerelim4=="B"
replace same_cR4=1 if veto_cR4==1 & partnerelim4=="C"
replace same_dR4=1 if veto_dR4==1 & partnerelim4=="D"
replace same_eR4=1 if veto_eR4==1 & partnerelim4=="E"
gen sameR1=0
replace sameR1=1 if same_a==1 | same_b==1 | same_c==1 | same_d==1 | same_e==1
replace sameR1=. if elim1==""

gen sameR2=0
replace sameR2=1 if same_aR2==1 | same_bR2==1 | same_cR2==1 | same_dR2==1 | same_eR2==1
replace sameR2=. if elim2==""

gen sameR3=0
replace sameR3=1 if same_aR3==1 | same_bR3==1 | same_cR3==1 | same_dR3==1 | same_eR3==1
replace sameR3=. if elim3==""

gen sameR4=0
replace sameR4=1 if same_aR4==1 | same_bR4==1 | same_cR4==1 | same_dR4==1 | same_eR4==1
replace sameR4=. if elim4==""

* Identifying aggressive vetoes

gen payoff_aR3=.
gen payoff_bR3=.
gen payoff_cR3=.
gen payoff_dR3=.
gen payoff_eR3=.

replace payoff_aR3=payoff_a if remaining_aR3==1 & treatment==3
replace payoff_bR3=payoff_b if remaining_bR3==1 & treatment==3
replace payoff_cR3=payoff_c if remaining_cR3==1 & treatment==3
replace payoff_dR3=payoff_d if remaining_dR3==1 & treatment==3
replace payoff_eR3=payoff_e if remaining_eR3==1 & treatment==3

gen max_payoffR3=max(payoff_aR3, payoff_bR3, payoff_cR3, payoff_dR3, payoff_eR3)

gen focal3=opp_payoff_a if payoff_a==max_payoffR3 & treatment==3 
replace focal3=opp_payoff_b if payoff_b==max_payoffR3 & treatment==3
replace focal3=opp_payoff_c if payoff_c==max_payoffR3 & treatment==3
replace focal3=opp_payoff_d if payoff_d==max_payoffR3 & treatment==3
replace focal3=opp_payoff_e if payoff_e==max_payoffR3 & treatment==3

gen a_betterR3=0
gen b_betterR3=0
gen c_betterR3=0
gen d_betterR3=0
gen e_betterR3=0

replace a_betterR3=1 if opp_payoff_a>focal3 & treatment==3
replace b_betterR3=1 if opp_payoff_b>focal3 & treatment==3
replace c_betterR3=1 if opp_payoff_c>focal3 & treatment==3
replace d_betterR3=1 if opp_payoff_d>focal3 & treatment==3
replace e_betterR3=1 if opp_payoff_e>focal3 & treatment==3


gen aggressive_aR3=0
gen aggressive_bR3=0
gen aggressive_cR3=0
gen aggressive_dR3=0
gen aggressive_eR3=0

replace aggressive_aR3=1 if a_betterR3==1 & veto_aR3==1 & treatment==3
replace aggressive_bR3=1 if b_betterR3==1 & veto_bR3==1 & treatment==3
replace aggressive_cR3=1 if c_betterR3==1 & veto_cR3==1 & treatment==3
replace aggressive_dR3=1 if d_betterR3==1 & veto_dR3==1 & treatment==3
replace aggressive_eR3=1 if e_betterR3==1 & veto_eR3==1 & treatment==3


gen payoff_aR4=.
gen payoff_bR4=.
gen payoff_cR4=.
gen payoff_dR4=.
gen payoff_eR4=.

replace payoff_aR4=payoff_a if remaining_aR4==1 & treatment==3
replace payoff_bR4=payoff_b if remaining_bR4==1 & treatment==3
replace payoff_cR4=payoff_c if remaining_cR4==1 & treatment==3
replace payoff_dR4=payoff_d if remaining_dR4==1 & treatment==3
replace payoff_eR4=payoff_e if remaining_eR4==1 & treatment==3

gen max_payoffR4=max(payoff_aR4, payoff_bR4, payoff_cR4, payoff_dR4, payoff_eR4)

gen focal4=opp_payoff_a if payoff_a==max_payoffR4 & treatment==3 
replace focal4=opp_payoff_b if payoff_b==max_payoffR4 & treatment==3
replace focal4=opp_payoff_c if payoff_c==max_payoffR4 & treatment==3
replace focal4=opp_payoff_d if payoff_d==max_payoffR4 & treatment==3
replace focal4=opp_payoff_e if payoff_e==max_payoffR4 & treatment==3

gen a_betterR4=0
gen b_betterR4=0
gen c_betterR4=0
gen d_betterR4=0
gen e_betterR4=0

replace a_betterR4=1 if opp_payoff_a>focal4 & treatment==3
replace b_betterR4=1 if opp_payoff_b>focal4 & treatment==3
replace c_betterR4=1 if opp_payoff_c>focal4 & treatment==3
replace d_betterR4=1 if opp_payoff_d>focal4 & treatment==3
replace e_betterR4=1 if opp_payoff_e>focal4 & treatment==3


gen aggressive_aR4=0
gen aggressive_bR4=0
gen aggressive_cR4=0
gen aggressive_dR4=0
gen aggressive_eR4=0

replace aggressive_aR4=1 if a_betterR4==1 & veto_aR4==1 & treatment==3
replace aggressive_bR4=1 if b_betterR4==1 & veto_bR4==1 & treatment==3
replace aggressive_cR4=1 if c_betterR4==1 & veto_cR4==1 & treatment==3
replace aggressive_dR4=1 if d_betterR4==1 & veto_dR4==1 & treatment==3
replace aggressive_eR4=1 if e_betterR4==1 & veto_eR4==1 & treatment==3

gen aggressiveR1=0
replace aggressiveR1=1 if aggressive_a==1 | aggressive_b==1 | aggressive_c==1 | aggressive_d==1 | aggressive_e==1
replace aggressiveR1=. if elim1==""

gen aggressiveR2=0
replace aggressiveR2=1 if aggressive_aR2==1 | aggressive_bR2==1 | aggressive_cR2==1 | aggressive_dR2==1 | aggressive_eR2==1
replace aggressiveR2=. if elim2==""

gen aggressiveR3=0
replace aggressiveR3=1 if aggressive_aR3==1 | aggressive_bR3==1 | aggressive_cR3==1 | aggressive_dR3==1 | aggressive_eR3==1
replace aggressiveR3=. if elim3==""

gen aggressiveR4=0
replace aggressiveR4=1 if aggressive_aR4==1 | aggressive_bR4==1 | aggressive_cR4==1 | aggressive_dR4==1 | aggressive_eR4==1
replace aggressiveR4=. if elim4==""

* Identifying cautious strategy

gen min_payoffR3=min(payoff_aR3, payoff_bR3, payoff_cR3, payoff_dR3, payoff_eR3)

gen cautious_aR3=0
gen cautious_bR3=0
gen cautious_cR3=0
gen cautious_dR3=0
gen cautious_eR3=0

replace cautious_aR3=1 if payoff_a==min_payoffR3 & veto_aR3==1 & treatment==3
replace cautious_bR3=1 if payoff_b==min_payoffR3 & veto_bR3==1 & treatment==3
replace cautious_cR3=1 if payoff_c==min_payoffR3 & veto_cR3==1 & treatment==3
replace cautious_dR3=1 if payoff_d==min_payoffR3 & veto_dR3==1 & treatment==3
replace cautious_eR3=1 if payoff_e==min_payoffR3 & veto_eR3==1 & treatment==3

gen min_payoffR4=min(payoff_aR4, payoff_bR4, payoff_cR4, payoff_dR4, payoff_eR4)

gen cautious_aR4=0
gen cautious_bR4=0
gen cautious_cR4=0
gen cautious_dR4=0
gen cautious_eR4=0

replace cautious_aR4=1 if payoff_a==min_payoffR4 & veto_aR4==1 & treatment==3
replace cautious_bR4=1 if payoff_b==min_payoffR4 & veto_bR4==1 & treatment==3
replace cautious_cR4=1 if payoff_c==min_payoffR4 & veto_cR4==1 & treatment==3
replace cautious_dR4=1 if payoff_d==min_payoffR4 & veto_dR4==1 & treatment==3
replace cautious_eR4=1 if payoff_e==min_payoffR4 & veto_eR4==1 & treatment==3

gen cautiousR1=0
replace cautiousR1=1 if cautious_a==1 | cautious_b==1 | cautious_c==1 | cautious_d==1 | cautious_e==1
replace cautiousR1=. if elim1==""

gen cautiousR2=0
replace cautiousR2=1 if cautious_aR2==1 | cautious_bR2==1 | cautious_cR2==1 | cautious_dR2==1 | cautious_eR2==1
replace cautiousR2=. if elim2==""

gen cautiousR3=0
replace cautiousR3=1 if cautious_aR3==1 | cautious_bR3==1 | cautious_cR3==1 | cautious_dR3==1 | cautious_eR3==1
replace cautiousR3=. if elim3==""

gen cautiousR4=0
replace cautiousR4=1 if cautious_aR4==1 | cautious_bR4==1 | cautious_cR4==1 | cautious_dR4==1 | cautious_eR4==1
replace cautiousR4=. if elim4==""

* Results, separating rounds

tab elim1 if treatment==3, mi
tab elim2 if treatment==3, mi
tab elim3 if treatment==3, mi
tab elim4 if treatment==3, mi

bysort profile: tab sameR1 if treatment==3
bysort profile: tab sameR2 if treatment==3
bysort profile: tab sameR3 if treatment==3

bysort profile: tab cautiousR1 if treatment==3
bysort profile: tab cautiousR2 if treatment==3
bysort profile: tab cautiousR3 if treatment==3

bysort profile: tab aggressiveR1 if treatment==3
bysort profile: tab aggressiveR2 if treatment==3
bysort profile: tab aggressiveR3 if treatment==3










